package cn.ecnu.common;

public class Permission {
    public static final int VIEW = 1;
    public static final int POST_PAPER = 2;
    public static final int POST_NOTE = 4;
    public static final int COMMENT = 8;
    public static final int ADMIN = 1024;

    public static boolean hasPermission(int value, int permission) {
        return (value & permission) != 0;
    }

    public static boolean isAdmin(int value) {
        return hasPermission(value, ADMIN);
    }


}
